package com.teensoft.base.locator;

import org.springframework.web.context.WebApplicationContext;

public class Locator {

	private static WebApplicationContext context = null;
	
	public static WebApplicationContext getContext() {
		return context;
	}
	
	public static void setApplicationContext(WebApplicationContext c){
		context = c;
	}
	
	public static Object lookUp(String key){
		return context.getBean(key);
	}
	
	@SuppressWarnings("unchecked")
	public static <T> T lookUp(String key, Class<T> clazz){
		return (T)context.getBean(key, clazz);
	}
}
